﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LastoRevival.Service.Contracts.Models;
using LastoRevival.Service.Implementations.Models;

namespace LastoRevival.Service.Implementations.Data
{
	interface IDataProvider
	{
		string GetPasswordHash(string username);
		//LoginResult ValidateLogin(string username, string passwordHash);
		Guid StartUserSession(string username, DateTime expirationDate);
		void RefreshUserSession(Guid token, DateTime expirationDate);
		DateTime GetSessionExpiration(Guid token);
		void EndUserSession(Guid token);

		IEnumerable<OnlineUser> GetOnlineUsers(DateTime activeThreshold);

		IEnumerable<PreviewForumModel> GetVisibleForums(int groupID);
		IEnumerable<PreviewForumModel> GetAllForums();

		Threads GetThreadsOnPage(int forumID, int currentPage, int pageSize);
		PreviewForumModel GetForum(int forumID);

		int CreatePost(int userID, CreatePostModel post);
		int CreateReply(int userID, CreateReplyModel reply);
		void UpdatePost(EditPostModel post, DateTime lastEdit, int lastEditUserID);

		ViewPostModel GetPostForViewing(int postID);
		EditPostModel GetPostForEditing(int postID);

		UserProfileDetails GetProfile(Guid loginToken);
		UserProfileDetails GetProfile(string username);
		string GetUsername(int userID);
		UserStats GetUserStats(int userID);

		ForumAccessConfiguration GetForumAccessForGroup(int groupID);

		int CreateUser(CreateUserModel user, VerificationCode verificationCode, int groupID);
		VerificationCode GetUserVerificationCode(string username);
		EditProfileModel GetProfileForEditing(string username);
		void UpdateProfile(EditProfileModel user);
		bool IsUsernameAvailable(string username);
		void VerifyUser(string username);
		void DeleteUser(string username);

		void ChangeLockState(int postID, bool locked);

		int CreateForum(CreateForumModel forum);
		void UpdateForum(EditForumModel forum);
		void DeleteForum(int forumID);
		EditForumModel GetForumForEditing(int forumID);


		IDictionary<int, ForumGroupAccess> GetGroupAccessToForum(int forumID);
		void UpdateForumAccessForForum(UpdateGroupPermissionsModel access);

	}
}
